<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.numeric.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.formatCurrency-1.4.0.pack.js'/>"></script>
<script src="<c:url value='/js/jquery/jqueryFileTree/jqueryFileTree.js' />" type="text/javascript"></script>
<script src="<c:url value='/js/file-browser.js' />" type="text/javascript"></script>
<link href="<c:url value='/js/jquery/jqueryFileTree/jqueryFileTree.css' />" rel="stylesheet" type="text/css" />
<link href="<c:url value='/css/dhtmlxcombo_addedit.css' />" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	$(document).ready(function() {

		$('#pageTitle').text('<spring:message code="editPartnergrant.heading" />');
			
		var fileBrowser = new FileBrowser('S:\\Scanned Documents','<c:url value="/js/jquery/jqueryFileTree/connectors/jqueryFileTree.jsp" />', 
			function(file) {
				$('#fileLocation').val(file);
			}
		);
		
		
	//	var z1 = dhtmlXComboFromSelect("partner");
	//	z1.enableFilteringMode(true);
		
	//	var z2 = dhtmlXComboFromSelect("seniorProgramOfficer");
	//	z2.enableFilteringMode(true);
		
	//	var z3 = dhtmlXComboFromSelect("parentProjectId");
	//	z3.enableFilteringMode(true);

	//	var z4 = dhtmlXComboFromSelect("programOfficer");
	//	z4.enableFilteringMode(true);
		
	//	var z5 = dhtmlXComboFromSelect("alphaidentifier");
	//	z5.enableFilteringMode(true);
		
	//    var z6 = dhtmlXComboFromSelect("programAssistant");
	//	z6.enableFilteringMode(true);
		
	//	 var z7 = dhtmlXComboFromSelect("status");
	//	z7.enableFilteringMode(true);
						
		
		$('#chooseFileButton').click(function() {
			fileBrowser.open();
		});

		$.validator.addMethod("drop_down_required", function(value, element) {
			return (value != "");
		}, "Please select an option.");
		
		$.validator.addMethod("dateValidation", 
                function(value, element) {
					 var date_ini = new Date($('#projectStartDate').val()).getTime();
					 var date_end = new Date($('#projectEndDate').val()).getTime();
					 if (date_ini > date_end) {
									return false;
								   }
						return true;
                     }, 
                    "The Partner Grant End date should be after Partner Grant Start Date."

		    );
		    

	
		$("#editPartnergrantForm").validate({			
			
			rules : {
				'partner.id' : {
					drop_down_required : true
				},
				'parentProject.id' : {
					drop_down_required : true
				},
				alphaidentifier : {
					drop_down_required : true
				},
				acronym : {
					required : true
				},
				costCenterNumber : {
					required : true
				},
				projectTitle : {
					required : true
				},
				partnerGrantStartDate : {
					required : true,
					//greaterThan: "#projectStartDate"
				},
				partnerGrantEndDate : {
					required : true,
					//greaterThan: "#projectEndDate"
				},
				'cipeprojectstatus.id' : {
					drop_down_required : true
				},
				projectStartDate : {
					required : true,
					greaterThan: "#partnerGrantStartDate",
					lessThan: "#partnerGrantEndDate"
				},
				projectEndDate : {
					required : true,
					dateValidation : true,
					greaterThan: "#partnerGrantStartDate",
					lessThan: "#partnerGrantEndDate"
				},
				cipeprojecttype : {
					required : true
				},
				'region.id' : {
					drop_down_required : true
				},
				'country.id' : {
					drop_down_required : true
				},
				'seniorProgramOfficer.id' : {
					drop_down_required : true
				},
				'programOfficer.id' : {
					drop_down_required : true
				},
				'programAssistant.id' : {
					drop_down_required : true
				},
				//matchingFunds : {
					//required : true
				//},
				acronym : {
					required : true
				},
				projectTitle : {
					required : true
				},
				partnerGrantFunds : {
					required : true
				},
				fiscalYear: {
					required : true
				}
			}
		});

	//	$(".dhx_combo_input").rules("add", { 
  	//		required:true,   	
	//	});
		
   //     $("#submitFormButton").bind("click",function(){        
   //    		var t= setTimeout(function(){
  //     		$('.dhx_combo_input').click();
   //    		$('.input-full-width text_grey').click();
   //    		},300);          
   //     });

		$("#regions").bind("change", function() {
		        
			loadDataViaAjax("loadCountries.do", {
				"regionId" : this.value
			}, parseCountriesJson);
		});
		//$("#regions").trigger("change");

		$("#partnerGrantFunds").numeric();
		$("#partnerGrantFundsDis").numeric();
		$("#matchingFunds").numeric();
		$("#matchingFundsDis").numeric();
		
		$("#partnerGrantFunds").bind("change", calcTotalFunds);
		$("#matchingFunds").bind("change", calcTotalFunds).trigger("change");

		$("#parentProjectId").bind("change", getConcatenateCostCenter);
		$("#alphaidentifier").bind("change", getConcatenateCostCenter).trigger("change");

		$("#partnerGrantStartDate").bind("change", getFiscalYear);

		$('#parentProjectId').change(function() {
			if (this.value != '') {
				loadDataViaAjax("getCipeprojectBean.do", {
					"cipeprojectId" : this.value
				}, function(bean) {
					$('#partnerGrantStartDate').val(bean.formattedStartDate);
					$('#partnerGrantEndDate').val(bean.formattedEndDate);
					$('#nedIdentifier').val(bean.nedIdentifier);
					$('#donorId').val(bean.donorName);
					$('#acronym').val(bean.acronym);
					$('#projectTitle').val(bean.title);
					$('#costCenterNumber').val(bean.costCenterNumber);
					$('#countries').val(bean.country);
					$('#regions').val(bean.region);
					
					$('#seniorProgramOfficer').val(bean.seniorProgramOfficer);
					$('#programOfficer').val(bean.programOfficer);
					$('#programAssistant').val(bean.programAssistant);
					
					parseDonorawardJson(bean.donoraward);
					$("#partnerGrantStartDate").trigger("change");
				});
			} else {
				$('#partnerGrantStartDate').val('');
				$('#partnerGrantEndDate').val('');
				$('#nedIdentifier').val('');
				$('#donorId').val('');
				$('#acronym').val('');
				$('#projectTitle').val('');
				$('#costCenterNumber').val('');
				$('#projectID').val('');
				$('#projectIDDis').val('');
				
				parseDonorawardJson(null);
			}
			;
		});
		$("#parentProjectId").trigger("change");
		
		$("#countries").bind("change", function() {
			loadDataViaAjax("loadCountryUsers.do", {
				"countryId" : this.value
			}, function(result) {
				$("#programOfficer").get(0).value = result.programOfficer ? result.programOfficer : "";
				$("#programAssistant").get(0).value = result.programAssistant ? result.programAssistant : "";
			});
		});
		
		var dtOpts = { /*onClose: function() { this.focus(); }*/ };
		//$("#partnerGrantStartDate").datepicker();
		//$("#partnerGrantEndDate").datepicker();
		$("#projectStartDate").datepicker(dtOpts);
		$("#projectEndDate").datepicker(dtOpts);
		
		$('#edit-donoraward').click(function() {
			var sel = document.getElementById("donorawardId");
			if(sel.selectedIndex >= 0) {
				var idVal = sel.options[sel.selectedIndex].value;
				if (idVal != 0) {
					loadDiv('content', 'showEditDonoraward.do?id=' + idVal);
				};
			};	
		});
		
		$('#view-cipeprojectsummary').click(function() {
			loadDiv('content', 'showCipeprojectSummary.do?id=' + $(this).attr('cipeprojectId'));
		});
		$('#add-reporting').click(function() {
			loadDiv('content', 'showAddReportingrequirements.do');
		});
		$('#add-partnermonitoring').click(function() {
			loadDiv('content', 'auditsForm.do?cipeprojectId=${cipeproject.id}');
		});		
		
		$('.close-button').click(function() {
			if(confirm('Are you sure you want to close the form?')) {
				window.location = '../secure/showDashboard.do';
			}
	     });
		
		$('#cancelButton').click(function() {
			var ans = confirm('Are you sure you want to cancel editing this record without saving it?');
			if (ans) {
				location.href = '../secure/showDashboard.do';
			}
		});	
		
		
	//	$("#regions" ).css('width','100%').combobox().addClass('input-full-width-req text_blue');
		
		sortDropDownListByText();
		
		<c:if test="${!empty mode && 'addPartnerGrant' == mode}">              
      		$('#showConfirmAddNarativeReport').click(function() {
      			$('<div>Would you like to enter Financial and Narrative Reporting at this time?<br/></div>').dialog({
                    dialogClass: 'confirmAddNarativeReportDialog',
                    title: 'Confirm Add Narative Report',
                    width: 310,
                    modal: true,
                    resizable: false,
     				buttons: 
     		          {
     					'Yes' : function() {
     						$(this).dialog('close');
     						$('#addNarativeReport').val('addNarativeReport');
     						$('#submitFormButton').click();
     					},
     					'No' : function() {
     						$(this).dialog('close');
     						$('#addNarativeReport').val('');
     						$('#submitFormButton').click();
     					}
     		          }
                  });
      			return false;
      		});			
		</c:if>	

		$("#partnergrantFormSubmit").attr("disabled","disabled");	
		$("#partnergrantFormSubmit").attr("class", "gray_btn");	
		
		<c:if test="${cipeproject.id !=null and cipeproject.id gt 0}">
		$('#partnerGrantFundsDis').val($('#partnerGrantFunds').val().replace(/[^0-9\.]+/g,""));
		$('#matchingFundsDis').val($('#matchingFunds').val().replace(/[^0-9\.]+/g,""));
		$('#matchingFundsDis').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		calcTotalFunds();
		$('#partnerGrantFundsDis').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		$('#totalDisbursedAmount').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		</c:if>
	});

	function getFiscalYear() {
		var str1 = document.getElementById("partnerGrantStartDate").value;
		var mon1 = parseInt(str1.substring(0, 2), 10);
		var dt1 = parseInt(str1.substring(3, 5), 10);
		var yr1 = parseInt(str1.substring(6, 10), 10);
		var dt2 = 1;
		var mon2 = 10;

		var date1 = new Date(yr1, mon1, dt1);
		var date2 = new Date(yr1, mon2, dt2);

		if (isNaN(yr1)) {
			//do nothing
		} else {

			if (date1 >= date2) {
				document.getElementById("fiscalYear").value = yr1 + 1;
			} else {
				document.getElementById("fiscalYear").value = parseInt(yr1);
			}
		}
	}

	function parseDateString(src) {
		if (src != null && src != "") {
			var mon = parseInt(src.substring(0, 2), 10);
			var dt = parseInt(src.substring(3, 5), 10);
			var yr = parseInt(src.substring(6, 10), 10);
			return new Date(yr, mon, dt);
		}
		return null;
	}


	function getConcatenateCostCenter() {
		var str1 = $("#parentProjectId option:selected").text();
		str1 = str1.slice(0, str1.indexOf('|')-1);
		var str2 = document.getElementById("alphaidentifier").value;
		var prIdDisTxt = document.getElementById("projectIDDis");
		prIdDisTxt.value = (str1 != "" && str2 != "") ? (str1 + str2) : "";
		document.getElementById("projectID").value = prIdDisTxt.value;
	}
	function calcTotalFunds() {
		var fundsAmnt = $("#partnerGrantFunds").val().trim();
		var matchAmnt = $("#matchingFunds").val().trim();
		var x1 = (fundsAmnt != "") ? ((isNaN(fundsAmnt) ? 0 : parseFloat(fundsAmnt))) : 0;
		var x2 = (matchAmnt != "") ? ((isNaN(matchAmnt) ? 0 : parseFloat(matchAmnt))) : 0;
		$("#totalDisbursedAmount").val(x1 + x2);
	}

	function parseCountriesJson(data) {
	    
		var html = "<option value=''>Select</option>";
		var directorId = "";
		if (data) {
			for (p in data) {
				if(p != 'director') { 
					html += "<option value='" + p + "'>" + data[p] + "</option>";
				} else {
					directorId = data[p];
				}
			}
		}
		$("#countries option").remove();
		$("#countries").append(html).trigger("change");
		$("#seniorProgramOfficer").get(0).value = directorId;
		sortDropDownListByText();
	}
	
	function parseDonorawardJson(data) {
		//var html = "<option value=''>Select</option>";
		var html = "";
		if (data) {
			for (p in data) {
				html += "<option value='" + p + "'>" + data[p] + "</option>";
			}
			$("#donorawardId").val(data[p]);
			$("#donorawardRefId").val(p);
			
		}
		//$("#donorawardId option").remove(); // for drop-down
		//$("#donorawardId").append(html); // for drop-down
	}
	
	function sortDropDownListByText() {
		// Loop for each select element on the page.

		$("select").each(function() {

			// Keep track of the selected option.
			var selectedValue = $(this).val();
			// Sort all the options by text.
			$(this).html($("option", $(this)).sort(function(a, b) {
				return a.text == b.text ? 0 : ((a.text < b.text) || a.text != '') ? -1 : 1;
			}));

			// Select one option.
			$(this).val(selectedValue);
		});
	}
	
	$('#partnerGrantFundsDis').blur(function(){
		$('#partnerGrantFunds').val($('#partnerGrantFundsDis').val().replace(/[^0-9\.]+/g,""));
		calcTotalFunds();
		$('#partnerGrantFundsDis').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		$('#totalDisbursedAmount').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
	});
	
	$('#matchingFundsDis').blur(function(){
		$('#matchingFunds').val($('#matchingFundsDis').val().replace(/[^0-9\.]+/g,""));
		calcTotalFunds();
		$('#matchingFundsDis').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		$('#totalDisbursedAmount').formatCurrency({colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
	});
	
	jQuery.validator.addMethod("greaterThan", 
			function(value, element, params) {

			    if (!/Invalid|NaN/.test(new Date(value))) {
			        return new Date(value) >= new Date($(params).val());
			    }

			    return isNaN(value) && isNaN($(params).val()) 
			        || (parseFloat(value) >= parseFloat($(params).val())); 
			},'Must be greater than or equal to Project Start Date.');
	
	jQuery.validator.addMethod("lessThan", 
			function(value, element, params) {

			    if (!/Invalid|NaN/.test(new Date(value))) {
			        return new Date(value) <= new Date($(params).val());
			    }

			    return isNaN(value) && isNaN($(params).val()) 
			        || (parseFloat(value) <= parseFloat($(params).val())); 
			},'Must be less than or equal to Project End Date.');
	
	//matchingFundsDis
	
	
	

	$('#editButton').click(function() {
		$("#partnergrantFormSubmit").removeAttr("disabled","disabled");	
		$("#partnergrantFormSubmit").attr("class", "blue_btn");
		$("#editButton").attr("disabled","disabled");
		$("#editButton").attr("class", "gray_btn");	
	});

</script>
<div id="editPartnergrantDiv">
	<form:form name="editPartnergrantForm" id="editPartnergrantForm" action="savePartnergrant.do" method="post" modelAttribute="cipeproject">
		<form:hidden path="id" />
		<form:hidden path="costCenterNumber" />
        <input type="hidden" name="addNarativeReport" id="addNarativeReport" />
	    <div class="main_form">
	    	<div class="form_head">
				<div class="floatL" style="padding-top:5px;">
					<c:choose>
			            <c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
					       <a href="#" id="view-cipeprojectsummary" class="blue_btn" cipeprojectId="${cipeproject.id}" tabindex="-1"><spring:message code="editPartnergrant.link.viewProject" /></a>
					       <a href="javascript:loadDiv('content', 'showAddReportingrequirements.do?cipeprojectId=${cipeproject.id}');" id="add-reporting" class="blue_btn" tabindex="-1"><spring:message code="editPartnergrant.link.reporting" /></a>
					       <a href="#" id="add-partnermonitoring" class="blue_btn" tabindex="-1"><spring:message code="editPartnergrant.link.partnerMonitoring" /></a> 
					    </c:when>
					    <c:otherwise>
					       <span id="add-reportingtemp" class="gray_btn" tabindex="-1"><spring:message code="editPartnergrant.link.reporting" /></span>
					      <!--   <a href="javascript:loadDiv('content', 'showAddReportingrequirements.do?cipeprojectId=2220');" id="add-reporting" class="blue_btn" tabindex="-1"><spring:message code="editPartnergrant.link.reporting" /></a>-->
					       <span id="add-partnermonitoringtemp" class="gray_btn" tabindex="-1"><spring:message code="editPartnergrant.link.partnerMonitoring" /></span>
					    </c:otherwise>
					</c:choose>   					
				</div>
	    		<a href="#" class="close-button gray_btn floatR" tabindex="-1">Close Form</a><br class="clear" />
	    	</div>
	        <div class="form_cont">		
				<table class="fiveColTable" width="100%" cellspacing="1" cellpadding="0">
					<tr class="row">
						<td colspan="5" style="text-align: center;">
							<%@ include file="/common/messages.jsp" %>
						</td>
					</tr>
					<tr class="row">
						<td class="label2"><spring:message code="editPartnergrant.label.partner" /></td>
						<td class="input-field">
							<form:select id="partner" path="partner.id" cssStyle="width: 74%;" cssClass="input-full-width-req text_blue" tabindex="1">
								<option value=""></option>
								<form:options items="${partnerList}" itemValue="id" itemLabel="partnerName" />
							</form:select>
                            <sj:submit id="addPartner" nameKey="editPartnergrant.name.button.addeditpartner" cssClass="blue_btn cancel" target="content" key="link.add" tabindex="-1"/>
							<form:errors path="partner.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.seniorProgramOfficer" /></td>
						<td class="input-field">
							<form:select id="seniorProgramOfficer" path="seniorProgramOfficer.id" cssClass="input-full-width-req text_blue" tabindex="9">
								<option value=""></option>
								<form:options items="${seniorProgramOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="seniorProgramOfficer.id" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.costCenter" /></td>
						<td class="input-field"><form:select id="parentProjectId" path="parentProject.id" cssClass="input-full-width-req text_blue" tabindex="2">
								<option value=""></option>
								<form:options items="${parentProjectList}" itemValue="id" itemLabel="fullCostCenterNumber" />
							</form:select>
							<form:errors path="parentProject.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.programOfficer" /></td>
						<td class="input-field">
							<form:select id="programOfficer" path="programOfficer.id" cssClass="input-full-width-req text_blue" tabindex="10">
								<option value=""></option>
								<form:options items="${programOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="programOfficer.id" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.suffix" /></td>
						<td class="input-field"><form:select id="alphaidentifier" path="alphaidentifier" cssClass="input-full-width-req text_blue" tabindex="3">
								<option value=""></option>
								<form:option value="OA" label="OA"></form:option>
								<form:option value="OB" label="OB"></form:option>
								<form:option value="OC" label="OC"></form:option>
								<form:option value="OD" label="OD"></form:option>
								<form:option value="OE" label="OE"></form:option>
								<form:option value="OF" label="OF"></form:option>
								<form:option value="OG" label="OG"></form:option>
								<form:option value="OH" label="OH"></form:option>
								<form:option value="OI" label="OI"></form:option>
								<form:option value="OJ" label="OJ"></form:option>
								<form:option value="OK" label="OK"></form:option>
								<form:option value="OL" label="OL"></form:option>
								<form:option value="OM" label="OM"></form:option>
								<form:option value="ON" label="ON"></form:option>
								<form:option value="OO" label="OO"></form:option>
								<form:option value="OP" label="OP"></form:option>
								<form:option value="OQ" label="OQ"></form:option>
								<form:option value="OR" label="OR"></form:option>
								<form:option value="OS" label="OS"></form:option>
								<form:option value="OT" label="OT"></form:option>
								<form:option value="OU" label="OU"></form:option>
								<form:option value="OV" label="OV"></form:option>
								<form:option value="OW" label="OW"></form:option>
								<form:option value="OX" label="OX"></form:option>
								<form:option value="OY" label="OY"></form:option>
								<form:option value="OZ" label="OZ"></form:option>
							</form:select>
							<form:errors path="alphaidentifier" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.programAssistant" /></td>
						<td class="input-field">
							<form:select id="programAssistant" path="programAssistant.id" cssClass="input-full-width-req text_blue" tabindex="11">
								<option value=""></option>
								<form:options items="${programAssistantList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="programAssistant.id" cssClass="error" />
						</td>
						
					</tr>
					
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.projectID" /></td>
						<td class="input-field">
							<input id="projectIDDis" type="text" value="" readonly="true" class="input-full-width text_grey" tabindex="-1"/>
							<form:hidden path="projectID"  />
							<form:errors path="projectID" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.partnerGrantFunds" /></td>
						<td class="input-field">
							<input id="partnerGrantFundsDis" type="text" class="input-full-width-req text_blue" tabindex="12"/>
							<form:hidden path="partnerGrantFunds" cssClass="input-full-width-req text_blue" />
							<form:errors path="partnerGrantFunds" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
						<td class="label2"><spring:message code="editPartnergrant.label.startDate" /></td>
						<td class="input-field">
							<form:input path="partnerGrantStartDate" disabled="true" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="partnerGrantStartDate" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.matchingFunds" /></td>
						<td class="input-field">
							<input id="matchingFundsDis" type="text" class="input-full-width text_white" tabindex="13"/>
							<form:hidden path="matchingFunds" cssClass="input-full-width text_white" />
							<form:errors path="matchingFunds" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.endDate" /></td>
						<td class="input-field">
							<form:input path="partnerGrantEndDate" disabled="true" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="partnerGrantEndDate" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.totalFunds" /></td>
						<td class="input-field">
							<form:input path="totalDisbursedAmount" disabled="true" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="totalDisbursedAmount" cssClass="error" />
						</td>
					</tr>
					<tr class="row">
						<td class="label2"><spring:message code="editPartnergrant.label.nedIdentifier" /></td>
						<td class="input-field">
							<form:input path="nedIdentifier" readonly="true" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="nedIdentifier" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.fileLocation" /></td>
						<td class="input-field file-browser-container">
							<form:input path="fileLocation" cssStyle="width: 70%;" cssClass="input-full-width text_white" tabindex="14"/> 
							<input id="chooseFileButton" style="width: 20%; min-width: 55px;" type="button" value="Edit" class="blue_btn" tabindex="-1"/>
							<form:errors path="fileLocation" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.donorAwardID" /></td>
						<td class="input-field">
							<form:input id="donorawardId" cssStyle="width: 70%;" disabled="true" path="donoraward.donorAwardNumber"  cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:hidden path="donoraward.id" id="donorawardRefId"/>
							<input type="button" class="blue_btn" style="width: 20%; min-width: 55px;" id="edit-donoraward" value="<spring:message code="link.view" />" tabindex="-1"/>
							<form:errors path="donoraward.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.fiscalYear"/></td>
						<td class="input-field">
							<form:input path="fiscalYear" cssClass="input-full-width-req text_blue"  tabindex="15"/>
							<form:errors path="fiscalYear" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.donorName" /></td>
						<td class="input-field">
							<form:input id="donorId" path="" readonly="true" cssClass="input-full-width text_grey" tabindex="-1"/>
							<%-- <form:errors path="" cssClass="error" /> --%>
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.memo" /></td>
						<td class="input-field">
							<form:input path="memo" cssClass="input-full-width text_white" tabindex="16"/>
							<form:errors path="memo" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.grantStartDate" /></td>
						<td class="input-field">
							<form:input path="projectStartDate" cssClass="input-full-width-req text_blue" tabindex="4"/>
							<form:errors path="projectStartDate" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.accountingQuestionnaire" /></td>
						<td class="input-field">
							<form:checkbox path="accountingQuestionnaireReceived" cssClass="input-full-width" value="true" tabindex="17"/>
							<form:errors path="accountingQuestionnaireReceived" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.grantEndDate" /></td>
						<td class="input-field">
							<form:input path="projectEndDate" cssClass="input-full-width-req text_blue" tabindex="5"/>
							<form:errors path="projectEndDate" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.checkPerformed" /></td>
						<td class="input-field">
							<form:checkbox path="terroristCheckPerformed" cssClass="input-full-width" value="true" tabindex="18"/>
							<form:errors path="terroristCheckPerformed" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.acronym" /></td>
						<td class="input-field">
							<form:input path="acronym" cssClass="input-full-width-req text_blue"  tabindex="-1"/>
							<form:errors path="acronym" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="editPartnergrant.label.blockTimeSheet" /></td>
						<td class="input-field">
							<form:checkbox path="blockTimeSheet" cssClass="input-full-width" checked="true" tabindex="19"/>
							<form:errors path="blockTimeSheet" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.projectTitle" /></td>
						<td class="input-field">
							<form:input path="projectTitle" cssClass="input-full-width-req text_blue"  tabindex="-1"/>
							<form:errors path="projectTitle" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="label.createdBy" /></td>
						<td class="input-field">
							<form:input disabled="true" path="createdBy.fullName" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="createdBy" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.status" /></td>
						<td class="input-field">
							<form:select id="status" path="cipeprojectstatus.id" cssClass="input-full-width-req text_blue"  tabindex="6">
								<form:options items="${cipeprojectstatusList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="cipeprojecttype.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="label.creationDate" /></td>
						<td class="input-field">
							<form:input disabled="true" path="creationDate" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="creationDate" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.region" /></td>
						<td class="input-field">
							<form:select path="region.id" cssClass="input-full-width-req text_blue" id="regions"  tabindex="7">
								<option value="">Select</option>
								<form:options items="${regionList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="region.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="label.updatedBy" /></td>
						<td class="input-field">
							<form:input disabled="true" path="updatedBy.fullName" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="updatedBy" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td class="label2"><spring:message code="editPartnergrant.label.country" /></td>
						<td class="input-field">
							<form:select path="country.id" cssClass="input-full-width-req text_blue" id="countries"  tabindex="8">
								<option value="">Select</option>
								<form:options items="${countryList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="country.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label2"><spring:message code="label.updationDate" /></td>
						<td class="input-field">
							<form:input disabled="true" path="updationDate" cssClass="input-full-width text_grey" tabindex="-1"/>
							<form:errors path="updationDate" cssClass="error" />
						</td>
					</tr>
		          	<tr class="row">
						<td class="input-field" colspan="7" style="text-align: center;">
							<input id="cancelButton" type="button" class="gray_btn" value="<spring:message code='button.cancel' />" tabindex="-1"/>
							<input id="editButton" class="blue_btn" type="button" value="Edit" tabindex="-1" />
                            <c:choose>
                              <c:when test="${!empty mode && 'addPartnerGrant' == mode}">
                                <input id="showConfirmAddNarativeReport" class="blue_btn" type="button" value="Save" tabindex="-1"/>
                                <sj:submit id="submitFormButton" target="editPartnergrantDiv" validate="true" tabindex="-1" cssClass="hiddenSubmitButton"/>
                              </c:when>
                              <c:otherwise>
                                <sj:submit id="partnergrantFormSubmit" cssClass="blue_btn" target="editPartnergrantDiv" key="editPartnergrant.button.save" validate="true" tabindex="-1"/>
                              </c:otherwise>
                            </c:choose>              
						</td>
					</tr>
					<!-- 
					<tr class="row">
						<td class="label2"><spring:message code="editPartnergrant.label.override" /></td>
						<td class="input-field"><form:checkbox path="override" cssClass="input-full-width" value="true" /></td>
						<td><form:errors path="override" cssClass="error" /></td>
					</tr>
					 -->
				</table>
			</div>
		</div>   
	</form:form>
</div>
